// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '中山市建筑业协会' },
    redirect: '/program/programDiscuss',
    // redirect: '/dashboard', 跳转至dashboard
    children: [
      // dashboard
      {
        path: '/dashboard',
        name: 'dashboard',
        // redirect: '/dashboard/workplace',
        component: () => import('@/views/dashboard/Monitor'),
        meta: { title: '数据看板/汇总统计', keepAlive: false, icon: bxAnaalyse, permission: ['dashboard'] }
      },
      {
        path: '/components',
        name: 'components',
        // redirect: '/dashboard/workplace',
        component: () => import('@/components/QrCode/QrCode'),
        meta: { title: '专家详情', keepAlive: true, icon: bxAnaalyse, permission: ['components'] }
      },
      // forms
      //此为变更菜单栏
      {
        path:'/programme',
        component: RouteView, 
        meta: { title: '危大工程方案管理', icon: 'file-search', permission: ['argumentExperts'] },
        children:[
          {
            path: '/form',
            redirect: '/form/base-form',
            component: RouteView,
            meta: { title: '论证专家库', icon: 'file-search', permission: ['argumentExperts'] },
            children: [
              {
                path: '/form/step-form',
                name: 'StepForm',
                component: () => import('@/views/form/basicForm/pendinglist'),
                meta: { title: '待审核列表', keepAlive: true, permission: ['argument_reviewedList'] }
              },
              {
                path: '/form/base-form',
                name: 'BaseForm',
                component: () => import('@/views/form/basicForm/expertlist'),
                meta: { title: '专家列表', keepAlive: true, permission: ['argument_expertsList'] }
              },
              {
                path: '/form/streamRecord',
                name: 'AdvanceForm',
                component: () => import('@/views/form/basicForm/streamRecord'),
                meta: { title: '流号记录列表', keepAlive: true, permission: ['argument_flowList'] }
              }
            ]
          },
          {
            path: '/program',
            redirect: '/program/programDiscuss',
            meta: { title: '方案论证', icon: 'slack', permission: [ 'argument' ] },
            component: RouteView, // () => import('@/views/program/programDiscuss'),
            children: [
              {
                path: '/program/programDiscuss',
                name: 'programDiscuss',
                component: () => import('@/views/program/programDiscuss'),
                meta: { title: '工作台账', keepAlive: false, permission: ['programDiscuss'] }
              }
            ]
          },
        ]
      },
      // {
      //   path: '/form',
      //   redirect: '/form/base-form',
      //   component: RouteView,
      //   meta: { title: '论证专家库', icon: 'file-search', permission: ['argumentExperts'] },
      //   children: [
      //     {
      //       path: '/form/step-form',
      //       name: 'StepForm',
      //       component: () => import('@/views/form/basicForm/pendinglist'),
      //       meta: { title: '待审核列表', keepAlive: true, permission: ['argument_reviewedList'] }
      //     },
      //     {
      //       path: '/form/base-form',
      //       name: 'BaseForm',
      //       component: () => import('@/views/form/basicForm/expertlist'),
      //       meta: { title: '专家列表', keepAlive: true, permission: ['argument_expertsList'] }
      //     },
      //     {
      //       path: '/form/streamRecord',
      //       name: 'AdvanceForm',
      //       component: () => import('@/views/form/basicForm/streamRecord'),
      //       meta: { title: '流号记录列表', keepAlive: true, permission: ['argument_flowList'] }
      //     }
      //   ]
      // },
      // // 方案论证
      // {
      //   path: '/program',
      //   redirect: '/program/programDiscuss',
      //   meta: { title: '方案论证', icon: 'slack', permission: [ 'argument' ] },
      //   component: RouteView, // () => import('@/views/program/programDiscuss'),
      //   children: [
      //     {
      //       path: '/program/programDiscuss',
      //       name: 'programDiscuss',
      //       component: () => import('@/views/program/programDiscuss'),
      //       meta: { title: '工作台账', keepAlive: false, permission: ['programDiscuss'] }
      //     }
      //     // ,
      //     // {
      //     //   path: '/program/examination',
      //     //   name: 'examination',
      //     //   component: () => import('@/views/program/examination'),
      //     //   meta: { title: '检查验收', keepAlive: true, permission: ['examination'] }
      //     // }
      //   ]
      // },

      //危大工程方案交底管理
      {
        path:'/disclose',
        component: RouteView,
        meta: { title: '危大工程方案交底管理', icon: 'file-search', permission: ['argumentExperts'] },
        children:[
          {
            path: '/crew',
            name: 'crew',
            component: () => import('@/views/disclose/crew'),
            meta: { title: '班组人员登记', keepAlive: true, permission: ['workInfo'] }
          },
          {
            path: '/securityplan',
            name: 'securityplan',
            component: () => import('@/views/disclose/securityplan'),
            meta: { title: '安全方案交底', keepAlive: true, permission: ['workInfo'] }
          },
          {
            path: '/technology',
            name: 'technology',
            component: () => import('@/views/disclose/technology'),
            meta: { title: '安全技术交底', keepAlive: true, permission: ['workInfo'] }
          }
        ]
      },

      //危大工程验收管理
      {
        path:'/check',
        component: RouteView,
        meta: { title: '危大工程验收管理', icon: 'file-search', permission: ['argumentExperts'] },
        children:[
          {
            path: '/inspection',
            name: 'inspection',
            component: () => import('@/views/check/inspection'),
            meta: { title: '危大工程巡检', keepAlive: true, permission: ['workInfo'] }
          },
          {
            path: '/checkup',
            name: 'checkup',
            component: () => import('@/views/check/checkup'),
            meta: { title: '危大工程验收', keepAlive: true, permission: ['workInfo'] }
          }
        ]
      },
      

      // list
      {
        path:'/mobile',
        component: RouteView,
        meta: { title: '创优申报及移动评审', icon: 'file-search', permission: ['argumentExperts'] },
        children:[
          {
            path: '/list',
            name: 'list',
            component: RouteView,
            redirect: '/list/expertlist',
            meta: { title: '评优专家库', icon: 'schedule', permission: ['reviewExperts'] },
            children: [
              {
                // 正常跳转
                path: '/list/card',
                name: 'CardList',
                component: () => import('@/views/list/pendinglist'),
                meta: { title: '待审核列表', keepAlive: true, permission: ['review_reviewedList'] }
          },
          {
            // 正常跳转
            path: '/list/basic-list',
            name: 'BasicList',
            component: () => import('@/views/list/expertlist'),
            meta: { title: '专家列表', keepAlive: true, permission: ['review_expertsList'] }
          },
          {
            // 正常跳转
            path: '/list/streamList',
            name: 'streamList',
            component: () => import('@/views/list/streamList'),
            meta: { title: '流号记录列表', keepAlive: true, permission: ['review_flowList'] }
          }
            ]
          },
          {
            path: '/mobileReview',
            name: 'mobileReview',
            component: RouteView,
            redirect: '/mobileReview/workInfo',
            meta: { title: '创优申报及移动评审', icon: 'mobile', permission: ['moblieReview'] },
            children: [
              {
                // path: '/specialPages/notAvaliable',
                // name: '',
                // component: () => import('@/views/specialPages/notAvaliable.vue'),
                path: '/mobileReview/workInfo',
                name: 'workInfo',
                component: () => import('@/views/mobileReview/workInfo.vue'),
                meta: { title: '申报台账', keepAlive: true, permission: ['workInfo'] }
              },
    
              // 正常跳转
              // 正常跳转
    
              {
                path: '/mobileReview/projectManage',
                name: 'projectManage',
                component: () => import('@/views/mobileReview/projectManage.vue'),
                meta: { title: '项目管理分类', keepAlive: true, permission: ['projectManage'] }
              },
              {
                path: '/mobileReview/mobileAdvance',
                name: 'mobileAdvance',
                component: () => import('@/views/mobileReview/mobileAdvance.vue'),
                meta: { title: '移动评审定义分类', keepAlive: true, permission: ['mobileAdvance'] }
              },
              {
                path: '/mobileReview/mobileManage',
                name: 'mobileManage',
                component: () => import('@/views/mobileReview/mobileManage.vue'),
                meta: { title: '移动评审管理分类', keepAlive: true, permission: ['mobileManage'] }
              }
            ]
          },
        ]
      },


      // {
      //   path: '/list',
      //   name: 'list',
      //   component: RouteView,
      //   redirect: '/list/expertlist',
      //   meta: { title: '评优专家库', icon: 'schedule', permission: ['reviewExperts'] },
      //   children: [
          
      //     // {
      //     //   path: '/list/table-list/:pageNo([1-9]\\d*)?',
      //     //   name: 'TableListWrapper',
      //     //   hideChildrenInMenu: true, // 强制显示 MenuItem 而不是 SubMenu
      //     //   component: () => import('@/views/list/TableList'),
      //     //   meta: { title: 'menu.list.table-list', keepAlive: true, permission: ['table'] }
      //     // },

      //     {
      //       // 正常跳转
      //       path: '/list/card',
      //       name: 'CardList',
      //       component: () => import('@/views/list/pendinglist'),
      //       // 正常跳转
      //       // path: '/specialPages/notAvaliable',
      //       // name: '',
      //       // component: () => import('@/views/specialPages/notAvaliable.vue'),
      //       meta: { title: '待审核列表', keepAlive: true, permission: ['review_reviewedList'] }
      //     },
      //     {
      //       // 正常跳转
      //       path: '/list/basic-list',
      //       name: 'BasicList',
      //       component: () => import('@/views/list/expertlist'),
      //       // 正常跳转
      //       // path: '/specialPages/notAvaliable',
      //       // name: '',
      //       // component: () => import('@/views/specialPages/notAvaliable.vue'),
      //       meta: { title: '专家列表', keepAlive: true, permission: ['review_expertsList'] }
      //     },
      //     {
      //       // 正常跳转
      //       path: '/list/streamList',
      //       name: 'streamList',
      //       component: () => import('@/views/list/streamList'),
      //       // 正常跳转
      //       // path: '/specialPages/notAvaliable',
      //       // name: '',
      //       // component: () => import('@/views/specialPages/notAvaliable.vue'),
      //       meta: { title: '流号记录列表', keepAlive: true, permission: ['review_flowList'] }
      //       // children: [
      //       //   {
      //       //     path: '/list/search/article',
      //       //     name: 'SearchArticles',
      //       //     component: () => import('../views/list/search/Article'),
      //       //     meta: { title: 'menu.list.search-list.articles', permission: ['table'] }
      //       //   },
      //       //   {
      //       //     path: '/list/search/project',
      //       //     name: 'SearchProjects',
      //       //     component: () => import('../views/list/search/Projects'),
      //       //     meta: { title: 'menu.list.search-list.projects', permission: ['table'] }
      //       //   },
      //       //   {
      //       //     path: '/list/search/application',
      //       //     name: 'SearchApplications',
      //       //     component: () => import('../views/list/search/Applications'),
      //       //     meta: { title: 'menu.list.search-list.applications', permission: ['table'] }
      //       //   }
      //       // ]
      //     }
      //   ]
      // },

      // // profile
      // {
      //   path: '/mobileReview',
      //   name: 'mobileReview',
      //   component: RouteView,
      //   redirect: '/mobileReview/workInfo',
      //   meta: { title: '创优申报及移动评审', icon: 'mobile', permission: ['moblieReview'] },
      //   children: [
      //     {
      //       // path: '/specialPages/notAvaliable',
      //       // name: '',
      //       // component: () => import('@/views/specialPages/notAvaliable.vue'),
      //       path: '/mobileReview/workInfo',
      //       name: 'workInfo',
      //       component: () => import('@/views/mobileReview/workInfo.vue'),
      //       meta: { title: '申报台账', keepAlive: true, permission: ['workInfo'] }
      //     },

      //     // 正常跳转
      //     // 正常跳转

      //     {
      //       path: '/mobileReview/projectManage',
      //       name: 'projectManage',
      //       component: () => import('@/views/mobileReview/projectManage.vue'),
      //       meta: { title: '项目管理分类', keepAlive: true, permission: ['projectManage'] }
      //     },
      //     {
      //       path: '/mobileReview/mobileAdvance',
      //       name: 'mobileAdvance',
      //       component: () => import('@/views/mobileReview/mobileAdvance.vue'),
      //       meta: { title: '移动评审定义分类', keepAlive: true, permission: ['mobileAdvance'] }
      //     },
      //     {
      //       path: '/mobileReview/mobileManage',
      //       name: 'mobileManage',
      //       component: () => import('@/views/mobileReview/mobileManage.vue'),
      //       meta: { title: '移动评审管理分类', keepAlive: true, permission: ['mobileManage'] }
      //     }
      //   ]
      // },

      // // result
      // {
      //   path: '/result',
      //   name: 'result',
      //   component: RouteView,
      //   redirect: '/result/success',
      //   meta: { title: 'menu.result', icon: 'check-circle-o', permission: ['result'] },
      //   children: [
      //     {
      //       path: '/result/success',
      //       name: 'ResultSuccess',
      //       component: () => import(/* webpackChunkName: "result" */ '@/views/result/Success'),
      //       meta: { title: 'menu.result.success', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
      //     },
      //     {
      //       path: '/result/fail',
      //       name: 'ResultFail',
      //       component: () => import(/* webpackChunkName: "result" */ '@/views/result/Error'),
      //       meta: { title: 'menu.result.fail', keepAlive: false, hiddenHeaderContent: true, permission: ['result'] }
      //     }
      //   ]
      // },

      // // Exception
      // {
      //   path: '/exception',
      //   name: 'exception',
      //   component: RouteView,
      //   redirect: '/exception/403',
      //   meta: { title: 'menu.exception', icon: 'warning', permission: ['exception'] },
      //   children: [
      //     {
      //       path: '/exception/403',
      //       name: 'Exception403',
      //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403'),
      //       meta: { title: 'menu.exception.not-permission', permission: ['exception'] }
      //     },
      //     {
      //       path: '/exception/404',
      //       name: 'Exception404',
      //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404'),
      //       meta: { title: 'menu.exception.not-find', permission: ['exception'] }
      //     },
      //     {
      //       path: '/exception/500',
      //       name: 'Exception500',
      //       component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/500'),
      //       meta: { title: 'menu.exception.server-error', permission: ['exception'] }
      //     }
      //   ]
      // },

      // 系统管理
      {
        path: '/account',
        component: RouteView,
        name: 'account',
        redirect: '/account/profession',
        meta: { title: '系统管理', icon: 'user', keepAlive: true, permission: ['systemManagement'] },
        children: [
          {
            path: '/account/category',
            name: 'category',
            component: () => import('@/views/account/category'),
            meta: { title: '工程类别定义', keepAlive: true, permission: ['profession'] }
          },
          {
            path: '/account/profession',
            name: 'profession',
            component: () => import('@/views/account/expertDefined'),
            meta: { title: '专家类别定义', keepAlive: true, permission: ['profession'] }
          },
          {
            path: '/account/dangerous',
            name: 'dangerous',
            component: () => import('@/views/account/dangerous.vue'),
            meta: { title: '危大工程分类定义', keepAlive: true, permission: ['dangerous'] }
          },
          {
            path: '/account/liveExamineDefined',
            name: 'liveExamineDefined',
            component: () => import('@/views/account/liveExamine'),
            meta: { title: '现场检查清单定义', keepAlive: true, permission: ['dangerous'] }
          },
          {
            path: '/account/listContent',
            name: 'listContent',
            component: () => import('@/views/account/liveExamine/listContent.vue'),
            meta: { title: '检查清单子项', keepAlive: true, permission: ['projectDefined'] },
            hidden: true
          },
          {
            path: '/account/projectDefined',
            name: 'projectDefined',
            component: () => import('@/views/account/projectDefined.vue'),
            meta: { title: '项目工程分类定义', keepAlive: true, permission: ['projectDefined'] }
          },
          // {
          //   path: '/account/mobile',
          //   name: 'mobile',
          //   component: () => import('@/views/exception/403'),
          //   meta: { title: '移动评审分类定义', keepAlive: true, permission: ['systemManagement'] }
          // },
          {
            path: '/account/manage',
            name: 'manage',
            component: () => import('@/views/account/center'),
            meta: { title: '用户账号管理', keepAlive: true, permission: ['manage'] }
          },
          {
            path: '/account/member',
            name: 'member',
            component: () => import('@/views/account/memberManage'),
            meta: { title: '会员管理', keepAlive: true, permission: ['member'] }
          },
          {
            path: '/account/proManage',
            name: 'proManage',
            component: () => import('@/views/account/projectManage'),
            meta: { title: '项目管理', keepAlive: true }
          },
          {
            path: '/account/dataManage',
            name: 'dataManage',
            component: () => import('@/views/account/dataBackup.vue'),
            meta: { title: '数据管理', keepAlive: true, permission: ['dataBackup'] }
          },
          {
            path: '/account/dataRule',
            name: 'dataRule',
            component: () => import('@/views/account/dataRule.vue'),
            meta: { title: '规则管理', keepAlive: true }
          },
          {
            path: '/changePw',
            name: 'changePw',
            component: () => import('@/views/user/changePw.vue'),
            meta: { title: '修改密码', keepAlive: true },
            hidden: true
          }
        ]
      }
      // other
      // {
      //   path: '/other',
      //   name: 'otherPage',
      //   component: RouteView,
      //   meta: { title: '其他组件', icon: 'slack', permission: [ 'dashboard' ] },
      //   redirect: '/other/icon-selector',
      //   children: [
      //     {
      //       path: '/other/icon-selector',
      //       name: 'TestIconSelect',
      //       component: () => import('@/views/other/IconSelectorView'),
      //       meta: { title: 'IconSelector', icon: 'tool', keepAlive: true, permission: [ 'dashboard' ] }
      //     },
      //     {
      //       path: '/other/list',
      //       component: RouteView,
      //       meta: { title: '业务布局', icon: 'layout', permission: [ 'dashboard' ] },
      //       redirect: '/other/list/tree-list',
      //       children: [
      //         {
      //           path: '/other/list/tree-list',
      //           name: 'TreeList',
      //           component: () => import('@/views/other/TreeList'),
      //           meta: { title: '树目录表格', keepAlive: true }
      //         },
      //         {
      //           path: '/other/list/edit-table',
      //           name: 'EditList',
      //           component: () => import('@/views/other/TableInnerEditList'),
      //           meta: { title: '内联编辑表格', keepAlive: true }
      //         },
      //         {
      //           path: '/other/list/user-list',
      //           name: 'UserList',
      //           component: () => import('@/views/other/UserList'),
      //           meta: { title: '用户列表', keepAlive: true }
      //         },
      //         {
      //           path: '/other/list/role-list',
      //           name: 'RoleList',
      //           component: () => import('@/views/other/RoleList'),
      //           meta: { title: '角色列表', keepAlive: true }
      //         },
      //         {
      //           path: '/other/list/system-role',
      //           name: 'SystemRole',
      //           component: () => import('@/views/role/RoleList'),
      //           meta: { title: '角色列表2', keepAlive: true }
      //         },
      //         {
      //           path: '/other/list/permission-list',
      //           name: 'PermissionList',
      //           component: () => import('@/views/other/PermissionList'),
      //           meta: { title: '权限列表', keepAlive: true }
      //         }
      //       ]
      //     }
      //   ]
      // }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'project',
        name: 'project',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Project')
      },
      {
        path: 'tryQrcode',
        name: 'tryQrcode',
        component: () => import(/* webpackChunkName: "user" */ '@/views/mobileReview/tryQrcode')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      }
      // {
      //   path: 'recover',
      //   name: 'recover',
      //   component: undefined
      // }
    ]
  },
  // {
  //   path: '/register',
  //   name: 'register',
  //   component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
  // },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
